package com.alex.spring.springBase;

/**
 *
 * @author Administrator
 * @date 2018\10\5 0005
 */
public class TextEditor {
    private SpellChecker spellChecker;
//    public TextEditor(SpellChecker spellChecker) {
//        System.out.println("Inside TextEditor constructor." );
//        this.spellChecker = spellChecker;
//    }

    public TextEditor( SpellChecker spellChecker, String name ) {
        this.spellChecker = spellChecker;
        this.name = name;
    }
    public void spellCheck() {
        spellChecker.checkSpelling();
    }

    /**
     * a setter method to inject the dependency.
     * @param spellChecker
     */
    public void setSpellChecker(SpellChecker spellChecker) {
        System.out.println("Inside setSpellChecker." );
        this.spellChecker = spellChecker;
    }

    /**
     * a getter method to return spellChecker
     * @return
     */
    public SpellChecker getSpellChecker() {
        return spellChecker;
    }

    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
